## mako

<%page expression_filter="h" args="online_help_token"/>

<%namespace name='static' file='../static_content.html'/>
<%!
from django.urls import reverse
from django.utils.translation import gettext as _
from lms.djangoapps.ccx.overrides import get_current_ccx
from openedx.core.djangoapps.site_configuration import helpers as configuration_helpers
from openedx.features.enterprise_support.utils import get_enterprise_learner_generic_name, get_enterprise_learner_portal

# App that handles subdomain specific branding
from lms.djangoapps.branding import api as branding_api
%>

<%
enterprise_customer_link = get_enterprise_learner_portal(request)
%>

<h1 class="header-logo">
  % if enterprise_customer_link:
    <a href="${settings.ENTERPRISE_LEARNER_PORTAL_BASE_URL}/${enterprise_customer_link.get('slug')}">
      <img class="logo" src="${enterprise_customer_link.get('logo')}" alt="${_('{name} Dashboard').format(name=enterprise_customer_link.get('name'))}"/>
        % if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge':
            <span class="font-italic"> | EDGE</span>
        % endif
    </a>
  % else:
    <a href="${branding_api.get_home_url()}">
      <%block name="navigation_logo">
        <img  class="logo" src="${branding_api.get_logo_url(is_secure)}" alt="${_("{platform_name} Home Page").format(platform_name=static.get_platform_name())}"/>
      </%block>
        % if settings.LOGO_IMAGE_EXTRA_TEXT == 'edge':
            <span class="font-italic"> | EDGE</span>
        % endif
    </a>
  % endif
  % if course:
    <div class="course-header">
      <span class="provider">${course.display_org_with_default}:</span>
      <span class="course-number">${course.display_number_with_default}</span>
      <%
      display_name = course.display_name_with_default
      if settings.FEATURES.get('CUSTOM_COURSES_EDX', False):
        ccx = get_current_ccx(course.id)
        if ccx:
          display_name = ccx.display_name
      %>
      <span class="course-name">${display_name}</span>
    </div>
  % endif
</h1>
% if enable_enterprise_sidebar:
  <div class="enterprise-tagline">
    <% tagline = configuration_helpers.get_value('ENTERPRISE_TAGLINE', settings.ENTERPRISE_TAGLINE) %>
    % if tagline:
      ${tagline}
    % endif
  </div>
% endif
